package com.jiazhong.Collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Test1 {
    public static void main(String[] args) {
        List<Integer> list=new ArrayList<>();
        Collections.addAll(list,21,3,45,32,76,45,78,45,5,34);
        System.out.println(list);
        Collections.sort(list);
        System.out.println(list);
        int index = Collections.binarySearch(list, 76);//无法倒序查找
        System.out.println(index);
        Collections.sort(list, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return -o1-o2;
            }
        });
        System.out.println(list);



    }
}
